﻿using System;
using System.Web.Configuration;

namespace VioletDevelopmentLaboratory.Net.Web.Configuration
{
	public sealed class HttpRuntimeSectionManager : ConfigurationManagerBase
	{
		private HttpRuntimeSection section;

		public HttpRuntimeSectionManager()
		{
			this.section = (HttpRuntimeSection)base.GetConfigurationSection("system.web/httpRuntime");
		}

		public void Modify(bool apartmentThreading, int appRequestQueueLimit, TimeSpan delayNotificationTimeout, bool enable, bool enableHeaderChecking, bool enableKernelOutputCache, bool enableVersionHeader, TimeSpan executionTimeout, int maxRequestLength, int maxWaitChangeNotification, int minFreeThreads, int minLocalRequestFreeThreads, int requestLengthDiskThreshold, bool requireRootedSaveAsPath, bool sendCacheControlHeader, TimeSpan shutdownTimeout, bool useFullyQualifiedRedirectUrl, int waitChangeNotification)
		{
			this.section.ApartmentThreading = apartmentThreading;
			this.section.AppRequestQueueLimit = appRequestQueueLimit;
			this.section.DelayNotificationTimeout = delayNotificationTimeout;
			this.section.Enable = enable;
			this.section.EnableHeaderChecking = enableHeaderChecking;
			this.section.EnableKernelOutputCache = enableKernelOutputCache;
			this.section.EnableVersionHeader = enableVersionHeader;
			this.section.ExecutionTimeout = executionTimeout;
			this.section.MaxRequestLength = maxRequestLength;
			this.section.MaxWaitChangeNotification = maxWaitChangeNotification;
			this.section.MinFreeThreads = minFreeThreads;
			this.section.MinLocalRequestFreeThreads = minLocalRequestFreeThreads;
			this.section.RequestLengthDiskThreshold = requestLengthDiskThreshold;
			this.section.RequireRootedSaveAsPath = requireRootedSaveAsPath;
			this.section.SendCacheControlHeader = sendCacheControlHeader;
			this.section.ShutdownTimeout = shutdownTimeout;
			this.section.UseFullyQualifiedRedirectUrl = useFullyQualifiedRedirectUrl;
			this.section.WaitChangeNotification = waitChangeNotification;
			this.Save();
		}
		public HttpRuntimeSection GetHttpRuntime()
		{
			return this.section;
		}
	}
}